function jsonp(url,config){
	const {params={},jsonp="cb"} = config;
	return new Promise(function(resolve,reject){
		const fnName = "JQuery"+Math.random().toString(36).slice(2);
		window[fnName] = function(data){
			resolve(data);
			delete window[fnName];
		}
		const script = document.createElement("script");
		params[jsonp] = fnName;// {fid:72,callback:fnName}
		script.src = url+"?"+Object.keys(params).map(key=>key+"="+params[key]).join("&");
		//https://fts.jd.com/area/get?fid=72&callback="+fnName;
		script.onload = function(){
			document.body.removeChild(script);
		}
		document.body.appendChild(script);
	})
	
}
export default jsonp;


